<!-- <template>
	<view>
		<u-popup :show="show" closeOnClickOverlay="false" mode="center" @click="click">
		    <view>
		        <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" labelWidth=75>
		        	<u-form-item label="姓名" prop="name" borderBottom ref="item1">
		        		<u--input v-model="phone" type="text" placeholder="请输入手机号"></u--input>
		        	</u-form-item>
		        </u--form>
				<u-button style="border-radius: 80rpx;" type="primary" text="登录" @click="sub"></u-button>
		    </view>
		</u-popup>
	</view>
</template> -->
<script>
	export default {
		data() {
			return {
				show:false,
				phone:'',
			}
		},
		methods:{
			click() {
				this.$store.commit('getphone',res.data)
			}
		},
		onLaunch: function() {
			console.log('App Launch')
			const b = this.$route.query
			console.log('bbbbbbbbbbbbbbbbbbbbb',b);
			this.bb = b.code
			uni.getStorage({
				key:'open',
				success: (res) => {
					console.log('12312312',res);
					this.$store.commit('getuser',res)
				}
			})
			uni.request({
				url:'http://124.223.168.50:8000/weixin/oauth/callback/',
				data:{
					code:this.bb
				},
				success: (res) => {
					console.log(res);
					console.log(1111111);
					try{
						if(res.data.data.openid){
							console.log('请求了吧');
							this.$store.commit('getuser',res)
							uni.setStorage({
								key:'open',
								data:res.data.data.openid,
								success: (res) => {
									console.log(res);
								},
								fail: (err) => {
									uni.showToast({
										title:'获取失败，请检查网络连接',
										icon:'none'
									})
								}
							})
						}
					}
					catch{
						uni.showToast({
							title:'网络出错',
							icon:'none'
						})
					}
						
					console.log(222222);
					// uni.showToast({
					// 	title:'搞定'
					// })
				},
				fail:err => {
					uni.showToast({
						title:'网络出错'
					})
				}
			})
			uni.getSystemInfo({
			    success: (res) => {
			      console.log("终端IP地址：" + res);
			    },
			});
			uni.request({
			        url: "https://api.ipify.org?format=json",
			        success: (res) => {
			          const ip = res.data.ip;
			          console.log("地址：" + res.data.ip);
					  this.$store.state.ip = ip
			        },
			      });
			//微信支付
			// uni.request({
			//     url:'https://api.mch.weixin.qq.com/pay/unifiedorder',
			// 	method:'POST',
			// 	// data:payment_params,
			// 	success: (res) => {
			//         console.log(res);
			// 	}
			// })
			// var jWeixin = require('jweixin-module')  
			// jWeixin.ready(function(res){  
			//     // TODO  
			// 	console.log(res);
			// });
			// uni.clearStorage()
			// uni.getStorage({
			// 	key:'phone',
			// 	success: (res) => {
			// 		console.log(res)
			// 		this.$store.commit('getphone',res.data)
			// 	},
			// 	fail: (err) => {
			// 		console.log(err)
			// 		this.show = true
			// 		uni.showModal({
			// 			title:'请输入手机号',
			// 			editable:true,
			// 			placeholderText:'输入手机号',
			// 			success: (res) => {
			// 				console.log(res)
			// 				uni.setStorage({
			// 					key:'phone',
			// 					data:res.content,
			// 					success: (ookk) => {
			// 						console.log(ookk)
			// 						this.$store.commit('getphone',res.content)
			// 					}
			// 				})
			// 			}
			// 		})
			// 	}
			// })
			
				// console.log(res);
				// uni.showToast({
				// 	title:'请求成功'
				// })
				
			
		},
		onShow: function() {
			console.log('App Show')
			// uni.request({
			// 	url:'http://192.168.0.48:8000/booking/cancelappointment/',
			// 	method:'POST',
			// 	data:{
			// 		// name:'111',
			// 		// money:123,
			// 		open_id:'888' 
			// 		// open_id:'123'
			// 	},
			// 	success: (res) => {
			// 		console.log(res)
			// 	}
			// })
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	* {
		margin: 0;
		padding: 0;
	}
	uni-page-head {
		display: none;
	}
</style>
